#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		int ma = -100;
		for (int i = 1; i <= n; i++) {
			int a, b, c, d;
			cin >> a >> b >> c >> d;
			int t1 = abs(a - c);
			int t2 = abs(b - d);
			ma = max(ma, t1 + t2);
		}
		cout << ma << endl;
	}
	return 0;
}